import { gameState } from './state.js';
import { Player } from './player.js';
import { updateDisplay } from './ui.js';

export const Shop = {
    attackCost: 50,
    healCost: 30,

    upgradeAttack() {
        if (gameState.gold >= this.attackCost) {
            gameState.gold -= this.attackCost;
            Player.attack += 5;
            Player.attackLevel++;
            window.Shop.attackCost = Math.floor(this.attackCost * 1.5);
			console.log(this.attackCost);
			updateDisplay();
        }
    },

    upgradeHealing() {
        if (gameState.gold >= this.healCost) {
            gameState.gold -= this.healCost;
            Player.healRate += 2;
            Player.healLevel++;
            window.Shop.healCost = Math.floor(this.healCost * 1.5);
			updateDisplay();
        }
    }
};

// 暴露到全局作用域
window.Shop = Shop;